﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace yq.ControllerBase
{
    /// <summary>
    /// 显示标题
    /// 暂时没有用了
    /// </summary>
    public class TitleFilterAttribute : ActionFilterAttribute
    {
        public string Description { get; set; }
        public string Keywords { get; set; }
        public string Title { get; set; }


        public TitleFilterAttribute(string _title, string _keywords ,string _description)
        {
            Title = _title;
            Keywords = _keywords;
            Description = _description;
        }

        /// <summary>
        /// 進入 Action 的時候執行
        /// </summary>
        /// <param name="filterContext"></param>
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            System.Web.Mvc.ControllerBase controller = filterContext.Controller;
            controller.ViewBag.Title = Title;
            controller.ViewBag.Description = Description;
            controller.ViewBag.Keywords = Keywords;
        }
    }
}